<script src="<? echo base_url(); ?>js/jquery.colorbox.js"></script>
<script type="text/javascript">
    function proccessForm2(string){
        var getData = $.parseJSON(string);
        if(getData.errors == 1 || getData.errors == true)
            window.location.reload(false);
        else
            $('#errors2').html(getData.errors);
    }

    $(document).ready(function(){
        $('.loginC').colorbox({inline: true, width: "35%", height: "60%"});
        
        $('#loginform').submit(function(eve){
            eve.preventDefault();
            $.ajax({
                url: '<?= base_url(); ?>user/login_in',
                type: 'POST',
                data: $('#loginform').serialize(),
                success: function(string){
                    proccessForm2(string);
                },
                error: function(){
                    alert('Co loi xay ra');
                }
            })
        });
});
</script>
<div class="loginContainer">
    <div id="login">
        <span><a class="loginC" href="#lightbox_c">Đăng nhập</a> | <a href="<?= site_url('dang_ky') ?>">Đăng ký</a></span>
    </div>
</div>
<div style="display: none;">
    <div id="lightbox_c">
        <form id="loginform" name="loginform" method="post" action="<?= base_url(); ?>user/login_in">
            <fieldset>
                <label id="errors2"></label>
                <fieldset>
                    <label for="username" >Tên đăng nhập</label>
                    <input type="text" name="username" id="username" />
                </fieldset>
                <fieldset>
                    <label for="password" >Mật khẩu</label>
                    <input type="password" name="password" id="password"/>
                </fieldset><br/>
                <fieldset>
                    <input type="submit" id="btnsubmit" value="Gửi"/>
                    <input type="reset" id="btnsubmit" value="Xóa"/>
                </fieldset>
                <br/>
                <span class="a"><a href="<?= site_url('user/quen_mk');?>">Quên mật khẩu</a></span>
            </fieldset>
        </form>
    </div>
</div>